import { INCREMENT, DECREMENT } from "../count/counter.const";

const initialState = {
    count: 0
}

export default (state = initialState, action) => {
    switch (action.type) {
        case INCREMENT:
            return {
                ...state,
                count: state.count + action.payload
            }
        case DECREMENT:
            return {
                ...state,
                count: state.count - action.payload
            }
        default:
            return state;
    }
}